<template>
  <button @click="button">发送</button>
</template>

<script>
import { useIntervalFn } from '@vueuse/core'
import { ref } from 'vue'
export default {
  setup () {
    const time = ref(0)
    const { pause, resume } = useIntervalFn(() => {
      time.value--
      console.log(time.value)
      if (time.value <= 0) {
        pause()
      }
    }, 1000, { immediate: false })
    const button = () => {
      time.value = 60
      resume()
    }
    return { button, time }
  }
}
</script>

<style>

</style>
